import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-plus'
import * as ElementIcons from '@element-plus/icons-vue'
import 'element-plus/dist/index.css'
import tipUtil from "@/utils/tipUtil";
import listener from "@/utils/listener";

const app = createApp(App)

// 导入转换图标名称的函数
// 统一注册el-icon图标
for(let iconName in ElementIcons){
    app.component(iconName,ElementIcons[iconName])
}
// 将el-icon的组件名称AbbbCddd转化为i-abbb-cddd形式
// 此前用switch做组件名时因关键字重复报错，所以格式统一加了前缀
// 例：Switch转换为i-switch，ArrowDownBold转换为i-arrow-down-bold
// export function transElIconName(iconName){
//     return 'i'+iconName.replace(/[A-Z]/g,(match)=>'-'+match.toLowerCase())
// }

// app.config.globalProperties.$staticResourcesUrl = 'http://192.168.1.6:80' //定义静态资源服务器baseUrl
app.config.globalProperties.$staticResourcesUrl = 'http://localhost:80' //定义静态资源服务器baseUrl
app.config.globalProperties.$tipUtil = tipUtil
app.use(store)
app.use(router)
app.use(ElementUI)
app.use(listener)
app.mount('#app')